class Solution {
public:
    string largestNumber(vector<int>& nums) {
        vector<string> s;
        for (auto x : nums) {
            s.push_back(to_string(x));
        }
        sort(s.begin(), s.end(), [](string a, string b) {return a + b > b + a;});
        string ans;
        for (auto str : s)
            ans += str;
        while (ans.size() > 1 && ans[0] == '0') ans.erase(ans.begin());
        return ans;
    }
};
